from os.path import isfile
from git.repo import Repo, base
import os

baseDir = os.path.join(os.path.expanduser("~"), "temp", "yapai")
for folder in os.listdir(baseDir):
    if os.path.isfile(os.path.join(baseDir, folder)):
        continue
    print(folder)
    repo = Repo(os.path.join(baseDir, folder))
    if repo.is_dirty():
        repo.git.reset("--hard", "origin/" + str(repo.active_branch))
